"use strict";

const {Controller} = require("egg");

class tagController extends Controller {
  async getAll() {
    const {ctx} = this;
    //const req = ctx.request.body;
    const res = await ctx.service.tagService.getAll();
    ctx.body = ctx.helper.json(
        res.data ? res.data : null,
        res.suc ? 200 : 500,
        res.msg
    );
  }
  async getByQuestion() {
    const {ctx} = this;
    const req = ctx.request.body;
    const res = await ctx.service.tagService.getByQuestion(req.q_id);
    ctx.body = ctx.helper.json(
        res.data ? res.data : null,
        res.suc ? 200 : 500,
        res.msg
    );
  }
}

module.exports = tagController